package com.foo.designpattern.command;

/**
 * com.foo.designpattern.command
 * Created with IntelliJ IDEA.
 * Created by jiang on 2016-04-25 9:39.
 *
 * @Description 命令：经由小二传达
 */
public class OrderCommand implements Command {
    private CookReceiver cookReceiver;

    /**
     * 小二传达顾客的点餐命令给厨师：要做什么或者要取消什么菜
     *
     * @param cookReceiver
     */
    public OrderCommand(CookReceiver cookReceiver) {
        this.cookReceiver = cookReceiver;
    }

    /**
     * 传达顾客要厨师执行的命令：做菜
     *wo
     * @param command 菜名
     */
    @Override
    public void execute(String command) {
        cookReceiver.cooking(command);
    }

    /**
     * 传达顾客要厨师执行的命令：取消做菜
     *
     * @param command 菜名
     */
    @Override
    public void undo(String command) {
        cookReceiver.unCooking(command);
    }
}
